package sse.ustc.cc.adapter;


import sse.ustc.cc.activity.DayClassInfoAty;
import sse.ustc.cc.activity.MonthClassInfoAty;
import sse.ustc.cc.activity.R;
import sse.ustc.cc.activity.WeekClassInfoAty;
import sse.ustc.cc.fragment.DayClassInfoFrag;
import sse.ustc.cc.fragment.MonthClassInfoFrag;
import sse.ustc.cc.fragment.WeekClassInfoFrag;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;


public class MyAdp extends FragmentPagerAdapter {
	 private ViewPager v;

	public MyAdp(FragmentManager fm, ViewPager v) {
		super(fm);
		this.v = v;
	}
    
	@Override
	public int getCount() {
		switch(v.getId()) {
		case R.id.day_classinfo:
			return DayClassInfoAty.DAY_NUM;  
		case R.id.week_classinfo:
			return WeekClassInfoAty.WEEK_NUM;
		case R.id.month_classinfo:
			return MonthClassInfoAty.MONTH_NUM;
		default:
			 return 0;
		}		
	}
    
	@Override
	public Fragment getItem(int position) {
		switch(v.getId()) {
		case R.id.day_classinfo:
			return DayClassInfoFrag.newInstance(position);  
			
		case R.id.week_classinfo:
			return WeekClassInfoFrag.newInstance(position);
		
		case R.id.month_classinfo:
			return MonthClassInfoFrag.newInstance(position);
		}
		return null;	
	}
}
